|
|
|
|
|
|
|
It's common among programming texts to have the reader begin by creating a very basic first program along the lines of the classic Hello, World application. In this extremely simple example, the user is asked to initiate some action such as clicking a button or pressing a key, and the computer responds with a message such as "Hello, World!" A slightly more advanced variation asks for the user's name and responds with a customized greeting like "Hello, Lauren!" |
|
|
|
|
|
|
|
|
Although these examples might be sufficient for demonstrating that you can indeed use a programming language to create a program, the resulting application isn't very useful. Our approach is to begin with a sample program that not only demonstrates the fundamentals of creating a Visual Basic application, but can also be used in the real world. |
|
|
|
|
|
|
|
|
In this chapter, you'll create a Loan Calculator program that calculates the periodic payment needed to repay a loan, based on various factors such as the loan term and interest rate. Your users will be able to input and modify values for these and other variable factors, perform the calculation, and view the results. In addition, they will be able to view an amortization schedule for the entire life of the loan. |
|
|
|
|
|
|
|
|
As you can see, the preceding paragraph specified what the program would do and what information was required to perform the task, and provided some information about how the interface should be designed. That wasn't so bad, was it? |
|
|
|
|
|
|
|
|
|
The application you'll be creating was adapted from a shareware program I wrote named My Amortizer. With proper planning and design, Visual Basic can be used to create commercial-quality software applications.  |
|
|
|
|
|
|
|
|
|
|
Creating Your Program's User Interface |
|
|
|
|
|
|
|
|
A program's user interface refers to the part(s) of the program that the user sees and interacts with. As you develop this application's interface, you'll see how to use some of the many tools provided in Visual Basic's Integrated Development Environment (IDE). As discussed in Chapter 1, "Starting out with Visual Basic," the Visual Basic IDE makes short work of interface design, which was once a daunting task at best. |
|
|
|
|
|
|
|
|
Before you begin, take a look at what the final product will look like. Figure 2.1 shows the Loan Calculator's main screen as it's being used. |
|
|
|
|
|
|
|
|
Let's begin by creating a new project. A project is simply a set of files that store information about the components that make up an application (program). To create a Visual Basic program, you customize your project's various components. |
|
|
|
|
|
|
|
|
To get started with the Loan Calculator program, start Visual Basic; you will see the New Project dialog box shown in Figure 2.2. If Visual basic is already running, or if you don't see the New Project dialog, choose File, New Project (see Figure 2.3). |
|
|
|
|
|